package com.example.demo.foward;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MediaTypeController {

    @ResponseBody
    @GetMapping("getU")
    public User getU(){
        User user = new User();
        user.setName("li si");
        user.setAge(30);
        int i = 1 / 0;
        return user;
    }

    @RequestMapping("getU2")
    public ResponseEntity getU2(){
        User user = new User();
        user.setName("li si");
        user.setAge(30);
        ResponseEntity entity = new ResponseEntity(HttpStatus.OK);
        return entity;
    }

}
